RequestFocus
The RequestFocus method requests that the ownership of the specified focus be assigned to the specified frame.
ODBoolean RequestFocus (in ODTypeToken focus, in ODFrame requestingFrame);
focus
- A tokenized string representing the focus type whose ownership is being requested, expressed as a 32-bit value.
requestingFrame
- A reference to a frame requesting the focus.
- return value
kODTrue
if the frame obtained the focus, otherwisekODFalse
.DISCUSSION
Thefocus
parameter must be the tokenized form of one of the focus constants (kODClipboardFocus
,kODKeyFocus
,kODMenuFocus
,kODModalFocus
,kODMouseFocus
,kODScrollingFocus
, orkODSelectionFocus
) or the tokenized form of a part-specific focus type. You can call the session object'sTokenize
method to obtain a token corresponding to one of these constants.Your part calls this method to request a single focus for one of its frames; to request multiple foci, your part calls the arbitrator's
RequestFocusSet
method. The return value indicates whether the specified frame obtained ownership of the specified focus.If the specified focus is nonexclusive, the specified frame is automatically granted ownership of the focus. If it is exclusive, the focus module calls the
BeginRelinquishFocus
method of the current owner's part to see if the current owner is willing to give it up.If the request is granted, the new ownership relationship is stored in the relevant focus modules. If the request fails, the existing ownership relationships remain intact.
If the request is granted, the arbitrator contains a reference to the frame. Parts should relinquish the focus in the
DisplayFrameClosed
orDisplayFrameRemoved
methods.EXCEPTIONS
kODErrFocusNotRegistered
- The specified focus is not registered.
SEE ALSO
TheODFocusType
type (page 889).
TheODTypeToken
type (page 877).
TheODArbitrator::RequestFocusSet
method (page 55).
TheODPart::BeginRelinquishFocus
method (page 482).
TheODSession::Tokenize
method (page 622).
Listing 2-31 on page 88 in OpenDoc Cookbook.
"Requesting Foci" on page 208 in OpenDoc Programmer's Guide.
"Handling a Simple Modal Dialog Box" on page 233 in OpenDoc Programmer's Guide.
"Acquiring and Relinquishing the Clipboard Focus" on page 356 in OpenDoc Programmer's Guide.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help